import 'package:flutter/material.dart';
import 'package:hook_up_rent/widgets/common_floating_button.dart';
import 'package:hook_up_rent/widgets/room_list_item_widget.dart';
import 'package:hook_up_rent/pages/home/tab_search/dataList.dart';

class RoomManagePage extends StatelessWidget {
  const RoomManagePage({super.key});

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2,
      initialIndex: 0,
      child: Scaffold(
        floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
        floatingActionButton: CommonFloatingActionButton(
          onTap: () {
            Navigator.of(context).pushNamed('room_add');
          },
          title: '发布房源',
        ),
        appBar: AppBar(
          title: const Text('房屋管理'),
          bottom: const TabBar(tabs: [
            Tab(
              text: '控制',
            ),
            Tab(
              text: '已租',
            )
          ]),
        ),
        body: TabBarView(children: [
          ListView(
              children: dataList.map((e) => RoomListItemWidget(e)).toList()),
          ListView(
              children: dataList.map((e) => RoomListItemWidget(e)).toList())
        ]),
      ),
    );
  }
}
